package com.baizhi.controller;

import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
public class UserController {
    @Autowired
    private UserService us;

    @RequestMapping("login")
    public String login(User user, HttpSession session){

        User uu = us.login(user);
        if(uu!=null){
            session.setAttribute("user",uu);
            return "main/main";

        }

        return "index";
    }
}
